/*
 * Copyright 2007 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0

 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.gwt.util.compat;

import java.util.Set;
import javax.lang.model.element.Modifier;

public class FieldNode implements Comparable<FieldNode> {
  String name;
  String type;
  Set<Modifier> mods;
  
  public FieldNode(String n, String t, Set<Modifier> m) {
    name = n;
    type = t;
    mods = m;
  }
  
  public FieldNode(String name) {
    this(name, null, null);
  }
  
  public String toString() {
    String ret = "";
    for (Modifier m : mods)
      ret += m.toString() + " ";
    ret += type + " " + name;
    return ret;
  }

  public int compareTo(FieldNode o) {
    return name.compareTo(o.name);
  }

  public boolean equals(Object obj) {
    return compareTo((FieldNode) obj) == 0;
  }
  
}
